package org.opens.hutool.io;

import cn.hutool.core.io.FileUtil;
import org.junit.Test;

import java.io.File;
import java.util.Arrays;

public class ProcessingAudioDemo {

    /**
     * 功能:
     * <p></p>
     * 输出:
     * <pre>
     *
     * </pre>
     * 说明:
     * <pre>
     *     1.
     * </pre>
     */
    @Test
    public void test18() {
        String audioPath = "C:\\Users\\张玉明\\Desktop\\ivr电话客服项目\\pcm文件\\testbbb.wav";
        String outPath = "C:\\Users\\张玉明\\Desktop\\ivr电话客服项目\\pcm文件\\out.wav";

        byte[] bytes = FileUtil.readBytes(new File(audioPath));
        File outFile = new File(outPath);

        byte[] descByte = new byte[bytes.length * 2 - 44];
        System.arraycopy(bytes, 0, descByte, 0, bytes.length);
        System.arraycopy(bytes, 44, descByte, bytes.length, bytes.length - 44);
        System.out.println(bytes.length + " " + descByte.length);

        FileUtil.writeBytes(descByte, outFile);
    }

    /**
     * 功能:
     * <p></p>
     * 输出:
     * <pre>
     *
     * </pre>
     * 说明:
     * <pre>
     *     1.
     * </pre>
     */
    @Test
    public void test51() {
        byte[] arr1 = new byte[]{1,2,3,4,5,6,7,8,9,10};
        byte[] arr2 = new byte[arr1.length * 2 - 3];

        System.arraycopy(arr1, 0, arr2, 0, arr1.length);
        System.arraycopy(arr1, 3, arr2, arr1.length, arr1.length - 3);
        System.out.println(Arrays.toString(arr2));
    }

}
